#ifndef _CDOWNLOAD_H_
#define _CDOWNLOAD_H_

#include <buola/dbus/cobject.h>

#include <buola/io/curi.h>
#include "cbitdaemon.h"

namespace buola { namespace bitdaemon {

class CDownload : public dbus::CObject<CDownload>
{
public:
    CDownload();
    virtual ~CDownload();

    virtual std::wstring GetStatusString()=0;
    virtual std::wstring GetName()=0;

    virtual void Pause()=0;
    virtual void Resume()=0;

    virtual double GetProgress()=0;
    virtual size_t GetSize()=0;
    virtual double GetDLSpeed()=0;
    virtual double GetULSpeed()=0;

    virtual int GetFileCount()=0;
    virtual std::string GetFileNameAt(int i)=0;

    virtual void SetPriority(int i,int pPrio)=0;

    virtual int GetTrackerCount()           {   return 0;           }
    virtual io::CURI GetTrackerURLAt(int i)     {   return io::CURI();  }
    virtual void AddTracker(const io::CURI &pURI)   {}

    uint64_t UID()      {   return mUID;    }
    
public:
    template <class tIntrospector>
    static void Introspect(tIntrospector &pI)
    {
        pI.template AddMethod<std::wstring()>("GetName",&CDownload::GetName);
        pI.template AddMethod<double()>("GetProgress",&CDownload::GetProgress);
        pI.template AddMethod<double()>("GetDLSpeed",&CDownload::GetDLSpeed);
        pI.template AddMethod<double()>("GetULSpeed",&CDownload::GetULSpeed);
    }
    
private:
    uint64_t mUID;
};

/*namespace bitdaemon*/ } /*namespace buola*/ }

#endif
